// 员工管理

import request from '@/utils/request'

// 获取员工的简单列表
// export function getEmployeeSimple() {
//   // 返回一个promise对象
//   return request({
//     url: '/sys/user/simple'
//   })
// }
export const getEmployeeSimple = () => request.get('/sys/user/simple')

// 获取员工列表
export const getEmployeeList = (params) => request.get('/sys/user', params)

// 删除员工
export const delEmployee = (id) => request.delete(`/sys/user/${id}`)

// 新增员工
export const addEmployee = (data) => request.post('/sys/user', data)

// 封装一个导入员工的接口
export const importEmployee = (data) => request.post('/sys/user/batch', data)

// 保存员工的基本信息
export const saveUserDetailById = (data) => request.put(`/sys/user/${data.id}`, data)

// 读取用户详情的基础信息
export const getPersonalDetail = (id) => request.get(`/employees/${id}/personalInfo`)

// 更新用户详情的基础信息
export const updatePersonal = (data) => request.put(`/employees/${data.userId}/personalInfo`, data)

// 获取用户的岗位信息
export const getJobDetail = (id) => request.get(`/employees/${id}/jobs`)

// 保存岗位信息
export const updateJob = (data) => request.put(`/employees/${data.userId}/jobs`, data)

// 给用户分配角色
export const assignRoles = (data) => request.put('/sys/user/assignRoles', data)
